import request from '../utils/request'

const api_url_hospital = '/admin/hospital/hospital'
const api_url_dict = '/admin/common/dict'
const api_url_department = '/admin/hospital/department'
const api_url_schedule = '/admin/hospital/schedule'

// 医院列表分页
export function getHospitalPage(pageNum, pageSize, searchObj) {
  return request({
    url: `${api_url_hospital}/page/${pageNum}/${pageSize}`,
    method: 'post',
    params: searchObj
  })
}

// 更新医院上线状态
export function updateHospitalStatus(id, status) {
  return request({
    url: `${api_url_hospital}/hospitalStatus/${id}/${status}`,
    method: 'post'
  })
}

// 根据dictcode查询所有子节点（所有省）
export function getDictByDictCode(dictCode) {
  return request({
    url: `${api_url_dict}/getDict/${dictCode}`,
    method: 'get'
  })
}

// 根据数据id查询子数据列表
export function getChildData(id) {
  return request({
    url: `${api_url_dict}/getChildData/${id}`,
    method: 'get'
  })
}

// 查询医院详情信息
export function getHospitalDetailById(id) {
  return request({
    url: `${api_url_hospital}/get/hospitalDetail/${id}`,
    method: 'get'
  })
}

// 查看医院科室
export function getDepartmentByHoscode(hoscode) {
  return request({
    url: `${api_url_department}/get/${hoscode}`,
    method: 'get'
  })
}

// 查询预约规则
export function getScheduleRule(pageNum,pageSize,hoscode,depcode) {
  return request({
    url: `${api_url_schedule}/get/scheduleRule/${pageNum}/${pageSize}/${hoscode}/${depcode}`,
    method: 'get'
  })
}

// 查询排班信息
export function getScheduleDetail(hoscode,depcode,workDate) {
  return request({
    url: `${api_url_schedule}/get/scheduleDetail/${hoscode}/${depcode}/${workDate}`,
    method: 'get'
  })
}
